#include "tcpServer.hpp"
#include "daemon.hpp"

#include <iostream>
#include <memory>

static void Usage(string str)
{
    cout<<"Usage: "<<str<< " local_port"<<endl;
}

int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }

    uint16_t port=atoi(argv[1]);
    unique_ptr<Server> svr(new Server(port));
    svr->initServer();

    daemonSelf();   //守护进程化

    svr->start();


    return 0;
}
